/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-08-09
 * Time: 23:26
 */
public class TestDemo {
    import java.util.ArrayList;
    public class Solution {
        public ArrayList<Integer> printListFromTailToHead(ListNode listNode){
            ArrayList<Integer>  ret=new ArrayList<>();
            ListNode  tmp=listNode;
            while(tmp!=null){
                ret.add(0,tmp.val);
                tmp=tmp.next;
            }
            return ret;
        }
    }
}
